<?php
Class URL {
    /**
     * $URL->modules return $_REQUEST['modules'] value
     */ 
    
    
    var $modules;
    var $op;        //operation
    
    function __construct(){
        $this->modules = $this->process_modules();
    }
    
    function process_modules(){
        if(!isset($_REQUEST['modules'])){
            $modules = '';
        }else{
            $modules =$_REQUEST['modules'];
        }
        
        return $modules;
    }        
    
    /**
     * Get modules value
     */
    function get($modules){
        $modules = $this->seoUrl($modules);
        if(isset($_REQUEST[$modules])){
            $output = $_REQUEST[$modules];
        }else{
            $output = null;
        }
        return $output;
    }
    
    function seoUrl($modules) {
        //Lower case everything
        $string = strtolower($modules);
        //Make alphanumeric (removes all other characters)
        $string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
        //Clean up multiple dashes or whitespaces
        $string = preg_replace("/[\s-]+/", " ", $string);
        //Convert whitespaces and underscore to dash
        $string = preg_replace("/[\s_]/", "-", $string);
        return $string;
    }
    
}
$FZ_Url = new URL;
?>